<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><%@page
	language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html>
<head>
<title>广播电视设备</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/js/ext/resources/css/ext-all.css"
	type="text/css">
<link rel="stylesheet" href="${webctx }/js/ext/resources/css/xtheme-gray.css" type="text/css">
<script language="JavaScript" src="${pageContext.request.contextPath}/js/ext/adapter/ext/ext-base.js"></script>
<script language="JavaScript" src="${pageContext.request.contextPath}/js/ext/js/ext-all.js"></script>
<script language="JavaScript"
	src="${pageContext.request.contextPath}/js/ext/resources/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/extInterceptor.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath}/images/dcfs/dcfs.css" type="text/css">
<script type="text/javascript">
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget='side';

var sm = new Ext.grid.CheckboxSelectionModel();
var MyViewport = Ext.extend(Ext.Viewport, {
	xtype: "viewport", 
	layout: 'fit',
	listeners:{
		"afterrender":function(){
			Ext.getCmp("dcfs_gbds_sb_grid").getStore().load();
		}
	},
	initComponent: function () { 
		this.items = {
			xtype:"grid",
          	title:"广播电视电磁设备列表",
            id:"dcfs_gbds_sb_grid",
            bodyBorder:true,
            //width:1000,
            loadMask: true,
            sm:sm,
            store: {
                xtype: "jsonstore",
                url:"DO_DCFS_GBDS_SB_JBXX",
                root:"DCFS_GBDS_SB_JBXX",
                baseParams: { active:3 },
                fields: [sm,
                	{name:"GBDS_SB_BH"},{ name: "GBDS_SB_MC"},{name:"GBDS_JM_MC"},
                	{name:"GBDS_SB_XH"},{name:"YT_MC"},{name:"YT_BH"},{name:"GBDS_SB_QYSJ"},
                	{name:"GBDS_FSSB_BCGL"},{name:"GBDS_FSSB_YXGL"},{name:"GBDS_FSSB_GZPL"},
                	{name:"GBDS_FSTX_JD"},{name:"GBDS_FSTX_WD"},{name:"TXXS_BH"},
                	{name:"JHFS_BH"},{name:"TXXS_MC"},{name:"JHFS_MC"},{name:"GBDS_FSTX_ZY"},{name:"GBDS_FSTX_JSGD"},
                	{name:"GBDS_FHKD"},{name:"GBDS_PBSB"},{name:"GBDS_JMZF_ZJJL"},
                	{name:"GBDS_BZ"},{name:"GBDS_IS_HJYXSP"},{name:"GBDS_HPSP_SJ"},
                	{name:"GBDS_IS_YS"},{name:"GBDS_HBYS_SJ"},{name:"GBDS_DT_MC"},
                	{name:"GBDS_DT_DD"},{name:"GBDS_SBDW"},{name:"GBDS_FSSB_GZPL"},
                	{name:"BD_JD"},{name:"BD_WD"}
                ]
            },
			columns:[sm,
				{header: '设备编号',width:100, dataIndex: 'GBDS_SB_BH', align: "left" },
				{header: '设备名称',width:300, dataIndex: 'GBDS_SB_MC', align: "left" },
				{header: '节目名称',width:300, dataIndex: 'GBDS_JM_MC', align: "left" },
				{header: '设备型号',width:300, dataIndex: 'GBDS_SB_XH', align: "left" },
				{header: '主要用途',width:200, dataIndex: 'YT_MC', align: "left" },
				{header: '用途编号',width:100, dataIndex: 'YT_BH', align: "left" },
				{header: '启用时间',width:100, dataIndex: 'GBDS_SB_QYSJ', align: "center" },
				{header: '标称功率（W）',width:100, dataIndex: 'GBDS_FSSB_BCGL', align: "right" },				
				{header: '运行功率（W）',width:100, dataIndex: 'GBDS_FSSB_YXGL', align: "right" },
				{header: '工作频率（Hz）',width:100, dataIndex: 'GBDS_FSSB_GZPL', align: "right" },
				//{header: '天线经度',width:100, dataIndex: 'GBDS_FSTX_JD', align: "right" },
				//{header: '天线纬度',width:100, dataIndex: 'GBDS_FSTX_WD', align: "right" },
				
				{header: '发射天线形式',width:200, dataIndex: 'TXXS_MC', align: "left" },
				{header: '极化方式',width:150, dataIndex: 'JHFS_MC', align: "left" },
				{header: '增益（dB）',width:100, dataIndex: 'GBDS_FSTX_ZY', align: "right" },
				{header: '架设高度（m）',width:100, dataIndex: 'GBDS_FSTX_JSGD', align: "right" },
				{header: '防护区宽度（m）',width:100, dataIndex: 'GBDS_FHKD', align: "right" },
				{header: '屏蔽设备',width:200, dataIndex: 'GBDS_PBSB', align: "left" },
				{header: '居民住房最近距离（m）',width:100, dataIndex: 'GBDS_JMZF_ZJJL', align: "right" },
				//{header: '备注',width:100, dataIndex: 'GBDS_BZ', align: "center" },
				//{header: '是否环境影响审批',width:200, dataIndex: 'GBDS_IS_HJYXSP', align: "left" },
				//{header: '环评审批时间',width:100, dataIndex: 'GBDS_HPSP_SJ', align: "center" },
				//{header: '是否经环境保护验收',width:200, dataIndex: 'GBDS_IS_YS', align: "left" },
				//{header: '环保验收时间',width:100, dataIndex: 'GBDS_HBYS_SJ', align: "center" },
				{header: '广播电台名称',width:200, dataIndex: 'GBDS_DT_MC', align: "left" },
				{header: '地点',width:200, dataIndex: 'GBDS_DT_DD', align: "left" },
				{header: '申报单位',width:210, dataIndex: 'GBDS_SBDW', align: "left" },
				{header: '',width:0, dataIndex: 'TXXS_BH', align: "left" },
				{header: '',width:0, dataIndex: 'JHFS_BH', align: "left" }
			],
			tbar:["->",
				{
				    xtype:'textfield',
		            id:"txt"
				},'-',
				{
					text:"查询",
					iconCls: "icon-search",
					handler:function(){
	                         Ext.getCmp("dcfs_gbds_sb_grid").getStore().load({params:{txt:Ext.getCmp("txt").getValue(), active:4 }});

	                        }
				},{
					text:"新增",
					iconCls: "icon-add",
					handler:function(){
						Ext.getCmp("dcfs_gbds_sb_form").getForm().reset();
						win.show();
						Ext.getCmp("center").setActiveTab(1);
			            Ext.getCmp("center").setActiveTab(0);
						Ext.getCmp("GBDS_SB_BH").setReadOnly(false);
						Ext.getCmp("GBDS_SB_QYSJ").setValue(new Date());
						Ext.getCmp("GBDS_HPSP_SJ").setValue(new Date());
						Ext.getCmp("GBDS_HBYS_SJ").setValue(new Date());
						win.action='add';
						win.setTitle('添加新设备');
						Ext.getCmp("submit").setText("添加");
					}
				},{
					text:"修改",
					iconCls: "icon-update",
					handler:function(){
						if(Ext.getCmp("dcfs_gbds_sb_grid").getSelectionModel().getCount()==1){
							var recordNum = -1;
						
                            for (var i = 0; i < Ext.getCmp("dcfs_gbds_sb_grid").getStore().getCount(); i++) {
                                if (Ext.getCmp("dcfs_gbds_sb_grid").getSelectionModel().getSelected(0).get("GBDS_SB_BH") == Ext.getCmp("dcfs_gbds_sb_grid").getStore().getAt(i).get("GBDS_SB_BH")) {
                            	 recordNum = i;
                                    break;
                             }
                             }
                              Ext.getCmp('Win').show();
                              Ext.getCmp("center").setActiveTab(1);
			                  Ext.getCmp("center").setActiveTab(0);
			                  win.setSize(840,345);
                              Ext.getCmp('Win').action='update';
                              Ext.getCmp('Win').recordNum=recordNum;
                              Ext.getCmp('Win').center();
                              Ext.getCmp("GBDS_SB_BH").setReadOnly(true);
                             // win.action='update';
							     if(Ext.getCmp('Win').changeValue!='-1'||Ext.getCmp("dcfs_gbds_sb_form"))
                                    {
                                        Ext.getCmp('Win').setTitle("广播电视设备信息");
                                        Ext.getCmp("submit").setText('保存');
                                        Ext.getCmp("dcfs_gbds_sb_form").getForm().loadRecord(Ext.getCmp("dcfs_gbds_sb_grid").getStore().getAt(recordNum));                                                                            
                                       
                                    }

                                    if(!Ext.getCmp("dcfs_gbds_sb_form"))
                                    {
                                        if(Ext.getCmp('Win').changeValue == '-1')
                                        {
                                            Ext.getCmp('Win').removeAll();
                                        }
                                        Ext.getCmp('Win').load({url:'DO_DCFS_GBDS_SB_JBXX',scripts:true,params:{loaditem:"add"}});
                                        Ext.getCmp('Win').changeValue = '1';
                                    }
                          
						} else if (Ext.getCmp("dcfs_gbds_sb_grid").getSelectionModel().getCount() == 0) {
                               Ext.Msg.alert("提示", "请最少选择一条记录");
                           }
                           else {
                               Ext.Msg.alert("提示", "只能选择一条数据进行编辑");
                           }
					}
				},{
					text:"删除",
					iconCls: "icon-delete",
					handler:function(){
						 if (Ext.getCmp("dcfs_gbds_sb_grid").getSelectionModel().getCount() > 0) {
                            Ext.MessageBox.confirm('提示', '数据删除后不可还原,是否删除?', function (btn) {
                                if (btn != "no") {
                                    var sbytList = "";
                                    for (var i = 0; i < Ext.getCmp("dcfs_gbds_sb_grid").getSelectionModel().getSelections().length; i++) {
                                        sbytList += Ext.getCmp("dcfs_gbds_sb_grid").getSelectionModel().getSelections()[i].get("GBDS_SB_BH");
                                        if (i < Ext.getCmp("dcfs_gbds_sb_grid").getSelectionModel().getSelections().length - 1) {
                                            sbytList += ",";
                                        }
                                    }
                                    var extAjax = Ext.Ajax;
                                    Ext.Msg.wait("提示","正在删除",{text:"正在删除数据..."});
                                    extAjax.request({
                                        url:"DO_DCFS_GBDS_SB_JBXX",
                                        method: 'POST',
                                        params:{active:1,lst:sbytList},
                                        callback: function (object, bool, response) {
                                        	Ext.Msg.hide();
                                            Ext.getCmp("dcfs_gbds_sb_grid").getStore().load();
                                        },
                                        failure: function (response) {
                                            Ext.Msg.alert("提示", "操作出现了异常！");
                                        }
                                    });
                                }
                            });
                        }
                        else if (Ext.getCmp("txxs_grid").getSelectionModel().getCount() == 0) {
                            Ext.Msg.alert("提示", "请最少选择一条记录");
                        }
					}					
				}
			],
			listeners: {
				"rowdblclick":function(g,recordNum,e) {
					Ext.getCmp("dcfs_gbds_sb_form").getForm().reset();
                    win.show();
                    Ext.getCmp("center").setActiveTab(1);
                    Ext.getCmp("center").setActiveTab(0);
                    win.setSize(840,345);
                    Ext.getCmp("GBDS_SB_BH").setReadOnly(true);
                    Ext.getCmp("GBDS_SB_QYSJ").setValue(new Date());
					Ext.getCmp("GBDS_HPSP_SJ").setValue(new Date());
					Ext.getCmp("GBDS_HBYS_SJ").setValue(new Date());
					win.action='update';
					win.setTitle('设备信息');
					Ext.getCmp("submit").setText("修改");				
					Ext.getCmp("dcfs_gbds_sb_form").getForm().loadRecord(Ext.getCmp("dcfs_gbds_sb_grid").getStore().getAt(recordNum));
					//alert(Ext.getCmp("ytbh").getValue());
                  /*  var jd=Ext.getCmp("dcfs_gbds_sb_grid").getStore().getAt(recordNum).get("GBDS_FSTX_JD").split(';');
                    Ext.getCmp('jd_D').setValue(jd[0]);
                    Ext.getCmp('jd_F').setValue(jd[1]);
                    Ext.getCmp('jd_M').setValue(jd[2]);
                
                    var wd=Ext.getCmp("dcfs_gbds_sb_grid").getStore().getAt(recordNum).get("GBDS_FSTX_WD").split(';');
                    Ext.getCmp('wd_D').setValue(wd[0]);
                    Ext.getCmp('wd_F').setValue(wd[1]);
                    Ext.getCmp('wd_M').setValue(wd[2]);
                    jkxtjd=Ext.getCmp('jd_D').getValue() + ',' + Ext.getCmp('jd_F').getValue()  + ',' + Ext.getCmp('jd_M').getValue();
                    jkxtwd=Ext.getCmp('wd_D').getValue() + ',' + Ext.getCmp('wd_F').getValue()  + ',' + Ext.getCmp('jd_M').getValue();*/
                }
			}
		}
		MyViewport.superclass.initComponent.call(this);
	}
});

var jbxxItems=[
   {
	   	xtype:"tabpanel",
	   	id:"center",
	    activeTab:0,
	    items:[
	    {
	    	layout:"column",
	    	title:"基本信息",
	        defaults:{columnWidth:.5,labelWidth:100,border:false},
	        items:[
	        	   {
	        		layout:"form",
	                bodyStyle:'padding:10px 5px 0px 10px',
	                defaultType:"textfield",
	                defaults:{anchor:'92%',border:false},
	                items:[
	                	  {
                          fieldLabel: '设备编号',
                          name:'GBDS_SB_BH', 
                          id:"GBDS_SB_BH",
                          tabIndex:1,
                          style:"color:#808080",
                          autoCreate:{tag:"input",type:"text",maxLength:20},
                          validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "编号不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
                    }, {
                        fieldLabel: '节目名称',
                        name: 'GBDS_JM_MC',
                        id:"GBDS_JM_MC",
                        tabIndex:3,
                        autoCreate:{tag:"input",type:"text",maxLength:128},
                        validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "节目名称不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
                    }, {                        
                        xtype:"combo",
                        fieldLabel: '主要用途',
                        name:'YT_MC',
                        id:"YT_MC",
                        tabIndex:5,
                        editable:false, 
                        triggerAction:'all', 
                        store:new Ext.data.JsonStore({
                            fields:[{name:"YT_MC"},{name:"YT_BH"}],
                            root:'root',
                            url:"SB_YT_JBXX_Servlet"
                        }),
                        mode:'local',
                        valueField: 'YT_BH',
                        displayField: 'YT_MC',
                        selectOnFocus:true,
                        emptyText:"请选择",
                        listeners:{
                        	"select":function(){
                        		Ext.getCmp("ytbh").setValue(Ext.getCmp("YT_MC").getValue());
                        		//alert(Ext.getCmp("ytbh").getValue());
                        	}
                        },
                        validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "主要用途不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
                    }, {
                        xtype:"combo",
                        fieldLabel: '极化方式',
                        name: 'JHFS_MC',
                        id:"JHFS_MC",
                        tabIndex:7,
                        editable:false, 
                        triggerAction:'all', 
                        store:new Ext.data.JsonStore({
                            fields:[{name:"JHFS_BH"},{name:"JHFS_MC"}],
                            root:'root',
                            url:"SB_TXJHFS_JBXX_Servlet"
                        }),
                        mode:'local',
                        valueField: 'JHFS_BH',
                        displayField: 'JHFS_MC',
                        selectOnFocus:true,
                        emptyText:"请选择",
                         listeners:{
                        	"select":function(){
                        		Ext.getCmp("jhfsbh").setValue(Ext.getCmp("JHFS_MC").getValue());
                        		//alert(Ext.getCmp("ytbh").getValue());
                        	}
                        },
                        validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "极化方式不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
                    },{
                        fieldLabel: '广播电台名称',
                        name: 'GBDS_DT_MC',
                        id:"GBDS_DT_MC",
                        tabIndex:9
                    },{
				        xtype: "combo",
				        name: "GBDS_IS_HJYXSP",
				        id: "GBDS_IS_HJYXSP",
				        editable: false,
				        triggerAction: 'all',
				        fieldLabel: "环境影响审批",
				        store: new Ext.data.SimpleStore({
				            fields: [{ name: "GBDS_IS_HJYXSP_LX" }],
				            data: [
				                ["是"],
				                ["否"]
				            ]
				        }),
				        mode: 'local',
				        valueField: 'GBDS_IS_HJYXSP_LX',
				        displayField: 'GBDS_IS_HJYXSP_LX',
				        selectOnFocus: true,
				        tabIndex:11,
				        emptyText:"请选择",
                        validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "环境影响审批不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
				    },{
				        xtype: "combo",
				        name: "GBDS_IS_YS",
				        id: "GBDS_IS_YS",
				        editable: false,
				        triggerAction: 'all',
				        fieldLabel: "环境保护验收",
				        store: new Ext.data.SimpleStore({
				            fields: [{ name: "GBDS_IS_YS_LX" }],
				            data: [
				                ["是"],
				                ["否"]
				            ]
				        }),
				        mode: 'local',
				        valueField: 'GBDS_IS_YS_LX',
				        displayField: 'GBDS_IS_YS_LX',
				        selectOnFocus: true,
				        tabIndex:13,
				        emptyText:"请选择",
                        validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "环境保护验收审批不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
				    },{
                xtype:'hidden',
                id:'ytbh',
                name:'YT_BH'
            }
	                ]
	        	},{
	        		layout:"form",
	                bodyStyle:'padding:10px 5px 0px 10px',
	                defaultType:"textfield",
	                defaults:{anchor:'92%',border:false},
	                items:[
	                	 {
                        fieldLabel: '设备名称',
                        name: 'GBDS_SB_MC',
                        id:"GBDS_SB_MC",
                        //style:"color:#808080",
                        tabIndex:2,
                        autoCreate:{tag:"input",type:"text",maxLength:128},
                        validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "设备名称不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
                    }, {
                        fieldLabel: '设备型号',
                        name: 'GBDS_SB_XH',
                        id:"GBDS_SB_XH",
                        //style:"color:#808080",
                        tabIndex:4,
                        autoCreate:{tag:"input",type:"text",maxLength:128},
                        validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "设备型号不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
                    }, {
                        fieldLabel: '启用时间',
                        name: 'GBDS_SB_QYSJ',
                        id:"GBDS_SB_QYSJ",
                        xtype: 'datefield',
				        editable: false,
				        format: 'Y-n-j',
				        value:new Date(),
                        tabIndex:6
                    }, {
                        xtype:"combo",
                        fieldLabel: '发射天线形式',
                        name: 'TXXS_MC',
                        id:"TXXS_MC",
                        tabIndex:8,
                        editable:false, 
                        triggerAction:'all', 
                        store:new Ext.data.JsonStore({
                            fields:[{name:"TXXS_BH"},{name:"TXXS_MC"}],
                            root:'root',
                            url:"SB_TXXS_JBXX_Servlet"
                        }),
                        mode:'local',
                        valueField: 'TXXS_BH',
                        displayField: 'TXXS_MC',
                        selectOnFocus:true,
                        emptyText:"请选择",
                        listeners:{
                        	"select":function(){
                        		Ext.getCmp("txxsbh").setValue(Ext.getCmp("TXXS_MC").getValue());
                        		//alert(Ext.getCmp("ytbh").getValue());
                        	}
                        },
                        validator:function(){
                            if(this.getValue().trim().length==0)
                            {
                                return "发射天线形式不能为空";
                            }
                            else
                            {
                                return true;
                            }
                        }
                    },{
				        fieldLabel: '申报单位',
				        name: 'GBDS_SBDW',
				        id:"GBDS_SBDW",
				        tabIndex:10
				    }, {
				    	fieldLabel: "审批时间",
				        xtype: 'datefield',
				        editable: false,
				        name: 'GBDS_HPSP_SJ',
				        id: 'GBDS_HPSP_SJ',
				        format: 'Y-n-j',
				        value:new Date()
				    },{
				    	fieldLabel: "验收时间",
				        xtype: 'datefield',
				        editable: false,
				        name: 'GBDS_HBYS_SJ',
				        id: 'GBDS_HBYS_SJ',
				        format: 'Y-n-j',
				        value:new Date()
				    },            //第二列
            {
                xtype:'hidden',
                id:'jhfsbh',
                name:'JHFS_BH'
            },{
                xtype:'hidden',
                id:'txxsbh',
                name:'TXXS_BH'
            },{
                xtype:'hidden',
                id:'GBDS_FSTX_JD',
                name:'GBDS_FSTX_JD'
            },{
                xtype:'hidden',
                id:'GBDS_FSTX_WD',
                name:'GBDS_FSTX_WD'
            }
	                ]
	        	}
	        ]
	    },
	    {
	    	layout:"column",
	    	title:"详细信息",
	        defaults:{columnWidth:.5,labelWidth:100,border:false},
	        items:[
	        	    {
	        		layout:"form",
	        		id:"form1",
	                bodyStyle:'padding:5px 5px 0px 10px',
	                defaultType:"textfield",
	                defaults:{anchor:'92%',border:false},
	                items:[
	                	{
                        fieldLabel: '标称功率(W)',
                        name: 'GBDS_FSSB_BCGL',
                        id:'GBDS_FSSB_BCGL',
                        tabIndex:1,
                        autoCreate:{tag:"input",type:"text",maxLength:10}
                    }, {
                        fieldLabel: '工作频率(Hz)',
                        name: 'GBDS_FSSB_GZPL',
                        id:"GBDS_FSSB_GZPL",
                        tabIndex:3,
                        autoCreate:{tag:"input",type:"text",maxLength:16}
                    }, {
                        fieldLabel: '架设高度(m)',
                        name: 'GBDS_FSTX_JSGD',
                        id:"GBDS_FSTX_JSGD",
                        tabIndex:5,
                        autoCreate:{tag:"input",type:"text",maxLength:10}
                    }, {
                        fieldLabel: '屏蔽设备',
                        name: 'GBDS_PBSB',
                        id:"GBDS_PBSB",
                        tabIndex:7
                    },{
                        fieldLabel: '经度',
                        name: 'jd_D',
                        id:"jd_D",
                        tabIndex:11
                    },{
                        fieldLabel: '居民住房最近距离(m)',
                        name: 'GBDS_JMZF_ZJJL',
                        id:"GBDS_JMZF_ZJJL",
                        tabIndex:8
                    }
	                       
	                ]
	        	},
	        	{
	        		layout:"form",
	        		id:"form2",
	                bodyStyle:'padding:10px 5px 0px 10px',
	                defaultType:"textfield",
	                defaults:{anchor:'92%',border:false},
	                items:[
	                	{
                        fieldLabel: '运行功率(W)',
                        name: 'GBDS_FSSB_YXGL',
                        id:"GBDS_FSSB_YXGL",
                        tabIndex:2
                    },  {
                        fieldLabel: '增益(dB)',
                        name: 'GBDS_FSTX_ZY',
                        id:"GBDS_FSTX_ZY",
                        tabIndex:4
                    },  {
                        fieldLabel: '防护区宽度(m)',
                        name: 'GBDS_FHKD',
                        id:"GBDS_FHKD",
                        tabIndex:6
                    }, {
                        fieldLabel: '地点',
                        name: 'GBDS_DT_DD',
                        id:"GBDS_DT_DD",
                        tabIndex:9
                    },{
                        fieldLabel: '纬度',
                        name: 'wd_D',
                        id:"wd_D",
                        tabIndex:10
                    },
                  {
                    xtype:"textarea",
                    name:"GBDS_BZ",
                    anchor:"92%",
                    id:"GBDS_BZ",
                    style:"margin-top:3px",
                    fieldLabel:"备注",
                    tabIndex:20,
                    height:60
                   }
	                ]
	        	}
	        ]
	    }
	    ]
   }
]




var win=new Ext.Window({
	id:"Win",
    title: '添加新设备',
    closable:true,
    layout:'fit',
    //autoScroll:true,
    //bodyStyle:'overflow-y:auto;overflow-x:hidden;',
    oper:'add',
    closeAction:'hide',
    resizable:false,
    autoDestroy:true,
    modal:true,
    width:900,
    height:350,
    action:'add',
    items:[
    	{
    		xtype:"form",
            id:"dcfs_gbds_sb_form",
             //layout:"form",
            border:false,
            //fileUpload: true,
            defaults:{border:false,labelWidth:100},
            listeners: {
				"hide":function(){
					Ext.getCmp("dcfs_gbds_sb_form").getForm().reset();
				}
    		},
            items:jbxxItems,
            buttons:[
                {
                    text:"添加",
                    id:"submit",
                    handler:function(){
                    	if(Ext.getCmp("dcfs_gbds_sb_form").getForm().isValid() == true){
                    		Ext.getCmp('GBDS_FSTX_JD').setValue(Ext.getCmp('jd_D').getValue());
                    		Ext.getCmp('GBDS_FSTX_WD').setValue(Ext.getCmp('wd_D').getValue());
	                    	if(win.action=='add'){
	                    		 Ext.getCmp("ytbh").setValue(Ext.getCmp("YT_MC").getValue()); 
		                        Ext.getCmp("dcfs_gbds_sb_form").getForm().submit({
		                            waitMsg : '正在提交表单数据,请稍候...',
		    						waitTitle : '正在验证数据...',
		                            method:"POST",
		                            url:"DO_DCFS_GBDS_SB_JBXX",
		                            params : { active: 0 },
		                            success:function(form,action){
		                            	Ext.Msg.hide();
		                                Ext.getCmp("dcfs_gbds_sb_grid").getStore().load();
		                                Ext.getCmp("dcfs_gbds_sb_form").getForm().reset();
		                                Ext.getCmp("GBDS_SB_QYSJ").setValue(new Date());
										Ext.getCmp("GBDS_HPSP_SJ").setValue(new Date());
										Ext.getCmp("GBDS_HBYS_SJ").setValue(new Date());
		                            },
		                            failure:function(form,action){
		                                Ext.Msg.alert("提示","操作出现了异常！");
		                            }
		                        });
	                        }else if(win.action=='update'){
	                        	Ext.getCmp("dcfs_gbds_sb_form").getForm().submit({
		                            waitMsg : '正在提交表单数据,请稍候...',
		    						waitTitle : '正在验证数据...',
	                        		method:"POST",
		                            url:"DO_DCFS_GBDS_SB_JBXX",
		                            params : { active: 2 },
		                            success:function(form,action){
		                            	Ext.Msg.hide();
		                            	Ext.getCmp("dcfs_gbds_sb_grid").getStore().load();
		                            	win.hide();
		                                Ext.getCmp("GBDS_SB_QYSJ").setValue(new Date());
										Ext.getCmp("GBDS_HPSP_SJ").setValue(new Date());
										Ext.getCmp("GBDS_HBYS_SJ").setValue(new Date());
										Ext.getCmp("dcfs_gbds_sb_form").getForm().reset();
		                            },
		                            failure:function(form,action){
		                                Ext.Msg.alert("提示","操作出现了异常！");
		                            }
		                        });
	                        }
	                    }
                    }
                },{
                       text:"取消",
                       handler:function(){
                            Ext.getCmp("Win").hide();
                            Ext.getCmp("dcfs_gbds_sb_form").getForm().reset();
                        }
                      
                }
            ]
    	}
    ],
    listeners:{
    	'hide':function(){     
    		Ext.getCmp("dcfs_gbds_sb_form").getForm().reset();
    	},
    	'afterrender':function(){
    		/*Ext.getCmp("YT_MC").getStore().load();
    		Ext.getCmp("JHFS_BH").getStore().load();
    		Ext.getCmp("TXXS_BH").getStore().load();*/
    		 Ext.getCmp("YT_MC").getStore().load({callback:function(){
    	    	Ext.getCmp("TXXS_MC").getStore().load({callback:function(){
    	    		Ext.getCmp("JHFS_MC").getStore().load();
    	    	}});
    	    }});
    	}
    }
});

Ext.onReady(function () {
    var viewport = new MyViewport();
    viewport.render();
});

</script>
</head>
<body id="dom">

</body>
</html>